<?php

namespace RTSCraft\MainBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

use RTSCraft\MainBundle\Entity\Factions;
use RTSCraft\MainBundle\Entity\Ressources;
use RTSCraft\MainBundle\Entity\Faction;


class DataCreationController extends Controller
{
  // Names for the forms.
  private $input_type = "";
  private $input_value = "";
  private $input_operation = "";

  private $info_string = "";
    /**
     * @Route("/", name="homepage")
     * @Template()
     */
    public function indexAction()
    {
      // index page
      return $this->render('RTSCraftMainBundle:DataCreation.html.twig');
    }

    /**
     * @Route("/send", name="operation")
     * @Template()
     */
    public function sendAction()
    {
      $entity = null;
      if ($request->getMethod() == "POST")
	{
	  // Perform the action.
	  switch ($request->request->get($input_type))
	    {
	      //FIXME
	    case "":
	      break;
	    }
	  if ($entity != null)
	    {
	      // Call the according method to perform the action.
	      switch ($request->request->get($input_operation))
		{
		case "":
		  break;
		}
	    }
	}
      // Fill the info string with info on the result.
      $this->info_string = "";
      // index page
      return $this->render('RTSCraftMainBundle:DataCreation.html.twig');
    }

}